package com.HeJing.方法的作用与声明;

/**
 * ClassName: Person
 * Package: com.HeJing.方法的作用与声明
 * Description:
 *
 * @Author: HeJing
 * @Create: 2023-03-20 10:48
 * @Version: 1.0
 */
public class Person {
    // 属性:
    String name;
    int age;
    char gender;

    // 方法:
    public void eat(){
        System.out.println(name + "在吃饭");
    }

    public void sleep(int hour){
        System.out.println("人至少每天睡眠" + hour + "个小时");
    }

    public String interests(String hobby){
        String info = "我的爱好是" + hobby;
        System.out.println(info);
        return info;
    }

    public int getAge(){
        return age;
    }
}




















